pub(crate) mod evaluator;
pub(crate) mod expr;
pub(crate) mod parser;
pub(crate) mod term;
pub(crate) mod tests;
pub(crate) mod tokstr;
pub(crate) mod utils;
pub(crate) mod vul;
use parser::Parser;
use tokstr::TokStr;

use crate::evaluator::Evaluator;
pub(crate) use crate::term::launch;

use std::process::Command;
fn main() {
    // 设置 perf stream paranoid = 0 关闭集成显卡
    let mut c = Command::new("sudo")
        .arg("sysctl")
        .arg("dev/i915/perf_stream_paranoid=0")
        .spawn()
        .unwrap();
    println!("{}", c.wait().unwrap());
    // 开启事件循环
    // test_demo();
    launch().unwrap();
}
fn test_demo() {
    let s = "log(2,x)";
    let x = TokStr::new(s.to_string());
    let p = Parser::new(x).parse_expr().unwrap();
    println!("{p:?}");

    let z_dict = Evaluator::eval_range(&p, -3.0..3.0, -3.0..3.0, 0.2);
    println!("{z_dict:?}");
}
